package fic.storefinder.server.db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import com.google.appengine.api.rdbms.AppEngineDriver;

import fic.storefinder.server.utils.PropertieReader;
import fic.storefinder.shared.utils.Constants;

public class Table {
	
	protected Connection connection;
	
	protected Table() {
		
	}
	
	public void openConnection() throws SQLException {
		 DriverManager.registerDriver(new AppEngineDriver());
		 String dbURL = PropertieReader.getInstance().getPropertieValueForKey(Constants.PROPERTIE_KEY_DBURL);
		 connection = DriverManager.getConnection(dbURL);
		 
	}
	
	public void closeConection() throws SQLException {
		if (connection != null) {
			connection.close();
		}
	}
 }
